<template>
	<view class="homeBox" :style="{'background-image':'url('+imgUrl+'news/bg.png'+')'}">
		<uni-nav-bar :fixed="true" leftWidth="620rpx">
			<template v-slot:left >
				<view class="homenav" @click="goPage('/page_home/search')">
					<image class="homenav-img" src="@/static/img/logo.png" mode="aspectFill"></image>
					<view class="homenavR">
						<i class="iconfont icon-sousuo homenavRSousuo" />
						<swiper class="swiper1" :indicator-dots="indicatorDots1" :circular="circular1" :vertical="vertical1"
							:autoplay="autoplay1" indicator-active-color="#ffffff" indicator-color='rgba(238,238,238,1)'
							:interval="interval1" :duration="duration1">
							<swiper-item v-for="(item,index) in NewsList" :key="index">
								<view class="swiper1View">
									{{item.title}}
								</view>
							</swiper-item>
						</swiper>
					</view>
				</view>
			</template>
		</uni-nav-bar>
		<view class="home-box">
			<!-- 轮播 -->
			<view class="homeLun-bo">
				<swiper :autoplay="true" :circular="true" :interval="3000" :duration="500">
					<swiper-item v-for="(item, index) in swiperList" :key="index">
						<image :src="item.image" mode="aspectFill" class="swiper-image"></image>
					</swiper-item>
				</swiper>
			</view>
			<!-- 横向滚动商品列表 -->
			<view class="home-scroll">
				<view class="home-scroll-title"><image class="home-scroll-title-img" src="@/static/img/hot.png" alt="" mode="aspectFill" /> 热卖中</view>
				<scroll-view scroll-x="true" class="scroll-container">
					<view class="product-list">
						<view v-for="(item, index) in productList" :key="index" class="product-item" @click="goPage('/page_home/plan?id='+item.id)">
							<image :src="item.image" mode="aspectFill" class="product-image"></image>
							<text class="product-name">{{ item.name }}</text>
							<text class="product-price">￥{{ item.price }}</text>
						</view>
					</view>
				</scroll-view>
			</view>
			<!-- 商品列表 -->
			<view class="shop-list">
				<view v-for="(item, index) in shopList" :key="index" class="shop-item">
					<!-- 商品图片 -->
					<image :src="item.image" mode="aspectFill" class="shop-image"></image>
					<!-- 商品信息 -->
					<view class="shop-info">
						<!-- 标题 -->
						<text class="shop-title">{{ item.title }}</text>
						<!-- 名字 -->
						<text class="shop-name">{{ item.name }}</text>
						<!-- 时间 -->
						<text class="shop-time">时间：{{ item.time }}</text>
						<view class="shop-info-bottom">
							<!-- 地点 -->
							<text class="shop-location">地点：{{ item.location }}</text>
							<!-- 价格 -->
							  <text class="shop-price"><text class="price-icon">￥</text> {{ item.price }}</text>
						</view>
					</view>
				</view>
			</view>
      <uLoadMore
        v-if="shopList.length>10"
        :status="more"
      ></uLoadMore>
		</view>
	</view>
</template>

<script>
import uLoadMore from '@/components/uni-load-more/uni-load-more.vue'
	import {
		mapGetters
	} from 'vuex'
	export default {
		name: 'uni_home',
		components: {
		},
		data() {
			return {
				imgUrl: this.$apiFun.imgUrl,
				host: this.$apiFun.host,
				more: 'more', //noMore more loading
				NewsList: [{title:'尚可喜剧'}], //输入框轮播文案
				// 输入框轮播
				indicatorDots1: false,
				autoplay1: true,
				vertical1: true,
				interval1: 5000,
				duration1: 1000,
				circular1: true,
				// 广告轮播
				swiperList: [{
						image: 'https://img01-gms.17zwd.com/imgextra01/61336614/i2/515677600375505480.jpg'
					},
					{
						image: 'https://qcloud.dpfile.com/pc/As5tfeAJ3bNz0EHihrTx4WJThVNQ8kb0ttUPBSmOWSUDY_ZFhBScrG7sKiYM3WjS.jpg'
					}
				],
				// 商品横向滑动
				productList: [{
						image: 'https://img01-gms.17zwd.com/imgextra01/61336614/i2/515677600375505480.jpg',
						name: '商品1',
						price: '99.99'
					},
					{
						image: 'https://qcloud.dpfile.com/pc/As5tfeAJ3bNz0EHihrTx4WJThVNQ8kb0ttUPBSmOWSUDY_ZFhBScrG7sKiYM3WjS.jpg',
						name: '商品2',
						price: '89.99'
					},
					{
						image: 'https://img01-gms.17zwd.com/imgextra01/61336614/i2/515677600375505480.jpg',
						name: '商品3',
						price: '79.99'
					},
					{
						image: 'https://qcloud.dpfile.com/pc/As5tfeAJ3bNz0EHihrTx4WJThVNQ8kb0ttUPBSmOWSUDY_ZFhBScrG7sKiYM3WjS.jpg',
						name: '商品4',
						price: '69.99'
					}
				],
				
				shopList: [{
						image: 'https://qcloud.dpfile.com/pc/_22NoSoft3aE6EJvPPVKZl7azJnSbjQvlobQc1TprekID0bsu-SAtCe9N8iBmkY3.jpg',
						title: '济南 张蔷2025「香草橙柿 一路繁花」LIVE巡演济南站济南 张蔷2025「香草橙柿 一路繁花」LIVE巡演济南站',
						time: '2023-10-01 14:00',
						name: '周杰伦',
						location: '北京',
						price: '99.99'
					},
					{
						image: 'https://qcloud.dpfile.com/pc/kDGPxk7sSy-IMWjRxmVIHmd0uS8A9nsAJlUIyucibgyztIovP0BrKDTdf2ycVz5i.jpg',
						title: '济南|李宗盛2025「有歌之年』巡回演唱会-济南站2',
						time: '2023-10-02 15:00',
						name: '大双',
						location: '上海',
						price: '89.99'
					},
					{
						image: 'https://qcloud.dpfile.com/pc/_22NoSoft3aE6EJvPPVKZl7azJnSbjQvlobQc1TprekID0bsu-SAtCe9N8iBmkY3.jpg',
						title: '济南|音乐剧《寻找李二狗》3',
						time: '2023-10-03 16:00',
						name: '二双',
						location: '广州',
						price: '79.99'
					},
					{
						image: 'https://qcloud.dpfile.com/pc/kDGPxk7sSy-IMWjRxmVIHmd0uS8A9nsAJlUIyucibgyztIovP0BrKDTdf2ycVz5i.jpg',
						title: '商品标题4',
						time: '2023-10-04 17:00',
						name: '小沈阳',
						location: '深圳',
						price: '69.99'
					},
					{
						image: 'https://qcloud.dpfile.com/pc/kDGPxk7sSy-IMWjRxmVIHmd0uS8A9nsAJlUIyucibgyztIovP0BrKDTdf2ycVz5i.jpg',
						title: '商品标题4',
						time: '2023-10-04 17:00',
						name: '林俊杰',
						location: '深圳',
						price: '69.99'
					},
					{
						image: 'https://qcloud.dpfile.com/pc/kDGPxk7sSy-IMWjRxmVIHmd0uS8A9nsAJlUIyucibgyztIovP0BrKDTdf2ycVz5i.jpg',
						title: '商品标题4',
						time: '2023-10-04 17:00',
						name: '周杰伦',
						location: '深圳',
						price: '69.99'
					}
				],
				paramObj: {
					addr: ''
				},
				pageObj:{
					
				}
			}
		},
		watch: {},
		computed: {
			//login_status 0 未登录 、1临时微信登录 2已登录
			...mapGetters([
				'login_status',

			]),

		},
		async onLoad(option) {
			this.init()
		},
		mounted() {

		},
		methods: {
			async init() {
			  this.more = 'loading'
			  let { data } = await this.$apiFun.getApi(
			    this.$api.overviewApi,
			    {}
			  )
			  console.log('data----------',data.body)
			  this.pageObj = data.body
			},
			  // async init() {
			  //   this.more = 'loading'
			  //   let { data } = await this.$apiFun.getApi(
			  //     this.$api.overviewApi,
			  //     {}
			  //   )
			  //   if (data.list.length > 0) {
			  //     this.paramArr = this.paramArr.concat(data.list)
			  //     this.more = 'more'
			  //   } else {
			  //     this.more = 'noMore'
			  //   }
			  // },
			goPage(url) {
				uni.navigateTo({
					url:url
				})
			},
			addrFun(val) {
				console.log('val---------', val)
			}
		},
		onReachBottom() {
			console.log(1111111111111)
			
			  this.paramObj.page++
			  this.init()
		},
		onPullDownRefresh() {},
	}
</script>

<style scoped lang="less">
	page {
		width: 100%;
		height: 100%;
		background: #f2f2fa;
		color: #6c6c6c;

		.homeBox {
			width: 100%;
			height: 100%;
		}

		.home-box {
			padding: 0 15rpx;
			box-sizing: border-box;

		}

		.homenav {
			height: 100rpx;
			width: 100%;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			background: #ffffff;
			.homenav-img{
				width: 60rpx;
				height: 60rpx;
				border: 2rpx solid #f87fa8;
				border-radius: 50%;
				margin-right: 20rpx;
			}
			.homenavR {
				display: flex;
				align-items: center;
				width: 100%;
				box-sizing: border-box;
				position: relative;
				flex: 1;

				.homenavRSousuo {
					position: absolute;
					z-index: 1;
					color: white;
					left: 30rpx;
					color: #8243da;
				}

				.swiper1 {
					width: 100%;
					height: 60rpx;
					// background-color: rgba(0, 0, 0, .1);
					border:1rpx solid #8243da;
					margin: 0 auto;
					border-radius: 60rpx;
					padding: 0 50rpx 0 80rpx;
					box-sizing: border-box;
					font-size: 24rpx;
					color: #333333;
					line-height: 60rpx;
					width: 100%;
					overflow: hidden;

					.swiper1View {
						white-space: nowrap;
					}
				}
			}

			.qiandao {
				width: 50rpx;
				height: 50rpx;
				margin-left: 20rpx;
			}
		}


		.homeLun-bo {
			margin-top: 15rpx;
			height: 300rpx;
			overflow: hidden;
			border-radius: 10rpx;

			.swiper-image {
				width: 100%;
				height: 300rpx;
			}
		}

		.home-scroll {
			background-color: #ffffff;
			margin-top: 15rpx;
			padding: 15rpx;
			box-sizing: border-box;
			border-radius: 6rpx;

			.home-scroll-title {
				display: flex;
				align-items: center;
				width: 100%;
				font-size: 32rpx;
				color: #6c6c6c;
				.home-scroll-title-img{
					width:32rpx;
					height:32rpx;
					margin-right: 5rpx;
				}
			}

			.scroll-container {
				white-space: nowrap;
				/* 防止换行 */
				width: 100%;
				padding: 10rpx 0 0rpx;

				.product-list {
					display: inline-flex;
					/* 横向排列 */
				}

				.product-item {
					width: 200rpx;
					margin-right: 15rpx;
				}

				.product-image {
					width: 200rpx;
					height: 200rpx;
					border-radius: 10rpx;
				}

				.product-name {
					display: block;
					font-size: 28rpx;
					margin-top: 10rpx;
				}

				.product-price {
					display: block;
					font-size: 24rpx;
					color: #ff5000;
					margin-top: 5rpx;
				}
			}


		}
/* 商品列表 */
		.shop-list {
			margin-top: 15rpx;
			display: flex;
			flex-direction: column;
			/* 竖向排列 */
			/* 单个商品项 */
			.shop-item {
				display: flex;
				align-items: center;
				padding: 30rpx 20rpx;
				box-sizing: border-box;
				margin-bottom: 20rpx;
				background-color: #fff;
				border-radius: 10rpx;
				overflow: hidden;
				box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1);
			}
			
			/* 商品图片 */
			.shop-image {
				border-radius: 10rpx;
				width: 140rpx;
				height: 200rpx;
			}
			
			/* 商品信息 */
			.shop-info {
				flex: 1;
				padding: 0;
				margin-left: 20rpx;
			}
			
			/* 商品标题 */
			.shop-title {
				font-size: 27rpx;
				color: #333;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				/* 限制文本显示为2行 */
				-webkit-box-orient: vertical;
				/* 垂直排列盒子 */
				overflow: hidden;
				/* 隐藏超出部分 */
				text-overflow: ellipsis;
				/* 显示省略号 */
				margin-bottom: 10rpx;
			}
			
			.shop-name {
				display: block;
				font-size: 28rpx;
				color: #ffbe86;
				margin-bottom: 5rpx;
			
			}
			
			.shop-time {
				display: block;
				font-size: 28rpx;
				color: #666;
				margin-bottom: 5rpx;
			}
			
			.shop-info-bottom {
				display: flex;
				align-items: center;
				justify-content: space-between;
			
				/* 商品地点 */
				.shop-location {
					display: block;
					font-size: 28rpx;
					color: #666;
					margin-bottom: 10rpx;
				}
			
				/* 商品价格 */
				.shop-price {
					display: block;
					font-size: 30rpx;
					color: #f87fa8;
					font-weight: bold;
					.price-icon{
						font-size: 18rpx;
					}
				}
			}
		}

	}
</style>